function check() {
    let selectedAmount = document.querySelector('input[name="recharge"]:checked');
    if (!selectedAmount) {
        let otherAmountInput = document.getElementById('other-amount');

        if (!selectedAmount && !otherAmountInput.value) {
            alert("请选择或输入充值金额");
            return false;
        }

        if (selectedAmount && otherAmountInput.value) {
            alert("请选择一种充值金额或者清空其他金额");
            return false;
        }

        if (otherAmountInput.value) {
            let amount = parseFloat(otherAmountInput.value);

            if (isNaN(amount) || amount <= 0) {
                alert("请输入一个有效的充值金额");
                return false;
            }
        }

        return true;
    } else {
        return true;
    }
}
  